module.exports = (db) => {
    const { INTEGER, STRING, CHAR, BIGINT, BOOLEAN, TINYINT } = require('sequelize').Sequelize
    const Article = db.define('article', {
        id: {
            type: INTEGER.UNSIGNED,
            primaryKey: true,
            allowNull: false,
            autoIncrement: true,
            unique: true,
            comment: '文章ID',
        },
        origin_id: {
            type: STRING(100),
            allowNull: false,
            comment: '源文章ID',
            defaultValue: ''
        },
        title: {
            type: STRING(200),
            allowNull: false,
            comment: '文章标题',
            defaultValue: ''
        },
        category_id: {
            type: TINYINT(3).UNSIGNED,
            allowNull: false,
            comment: '文章分类ID',
        },
        is_top: {
            type: TINYINT(3).UNSIGNED,
            allowNull: false,
            comment: '是否置顶',
            defaultValue: 0
        },
        user_id: {
            type: INTEGER(11),
            allowNull: false,
            comment: '关联用户ID',
        },
        view_count: {
            type: INTEGER(10).UNSIGNED,
            allowNull: false,
            comment: '阅读总数',
            defaultValue: 0
        },
        reply_count: {
            type: INTEGER(10).UNSIGNED,
            allowNull: false,
            comment: '回复总数',
            defaultValue: 0
        },
        created_at: {
            type: BIGINT.UNSIGNED,
            allowNull: false,
            comment: '创建时间',
        },
    }, {
        timestamps: false,
    });
    return Article;
}